

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code: 'inscricao.label', default: 'Inscricao')}" />
  <title><g:message code="default.list.label" args="[entityName]" /></title>
 

   <script type="text/javascript">
   function mostra_ajax(indexador) {
document.getElementById("imgAjax" + indexador ).style.display = 'block';
}

   function esconde_ajax(indexador) {
document.getElementById("imgAjax" + indexador ).style.display = 'none';
 



}
   </script>
 

</head>
<body>
     <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
<div class="body">
   <g:ifAnyGranted role="ROLE_ADMIN,ROLE_USER_SUPER,ROLE_GESTOR,ROLE_REVISOR" >
     <h1 style="text-align: center;">INSCRI&Ccedil;&Otilde;ES</h1>
 
<div class="list">
  <table style="width: 840px;" class="datagrid"  >
    <thead>
    <col width ="10%">
      <col width ="30%">
      <col width ="10%">
      <col width ="50%">
      <col width ="10%">
      <tr>

        <th>N&ordm; INSCRI&Ccedil;&Atilde;O</th>
        <th colspan="1" >ESTABELECIMENTO</th>
        <th colspan="1" >MODALIDADE</th>
        <th colspan="2" >STATUS</th>
        

    </tr>
    </thead>
    <tbody>
    <g:each in="${inscricaoInstanceList}" status="i" var="inscricaoInstance">
      <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">    
      <td>${fieldValue(bean: inscricaoInstance, field: "inscricao")}</td>
<td>${fieldValue(bean: inscricaoInstance, field: "razaoSocial")}</td>
<td>${fieldValue(bean: inscricaoInstance, field: "modalidadeAtendimento")}</td>
      <td id="status${i}">
      <g:if test="${inscricaoInstance.ativo == true}">
      ${InscricaoAcompanhamento.situacao( InscricaoAcompanhamento.findAllByInscricao(inscricaoInstance ,['sort':'id','order':'desc'])[0].status)}
            </g:if> <g:else>
              <font style="color:red;">Aguardando Candidato Confirmar Inscri&ccedil;&atilde;o</font>
            </g:else>


      </td>
      <td>


         <g:if test="${inscricaoInstance.ativo == true}">
         <div id ="tdA${i}"

        <a  style="cursor: pointer"   onclick="${remoteFunction(controller:'inscricao',action:'ajaxEdit',onLoading :'mostra_ajax(' + i + ')',onComplete  :'esconde_ajax(' + i + ')'  , params:['id': inscricaoInstance.id , 'indexador' : i] , update:[success:'div'+ i] )}    " >  Editar
<img src="../images/ajax-barra.gif" alt="carregando" id="imgAjax${i}" style=" display: none;" />

        </a>
          </div>
          <div id ="tdB${i}">
            <a  style="cursor: pointer;display: none;" >Ocultar </a>
       </div>
            </g:if> <g:else>
              
            </g:else>


  

      </td>
       </tr>
      <tr>
        <td colspan="4">
      <div id="div${i}" >
        </div>
      </td>
      </tr>     
    </g:each>
    </tbody>
  </table>
</div>
  </g:ifAnyGranted>
</div>

</body>
</html>
